package com.jk.vehicle.mini.constant;

/**
 * 危化柜存取操作类型枚举
 */
public enum AccessHistoryTypeEnum {
    /**
     * 企业存取统计
     */
    CORP((byte)1, "企业存取统计"),

    /**
     * 柜子存取统计
     */
    CABINET((byte)2, "柜子存取统计"),

    /**
     * 危化品存取统计
     */
    CHEMICAL((byte)3, "危化品存取统计");

    private Byte code;

    private String name;

    AccessHistoryTypeEnum(Byte code, String name) {
        this.code = code;
        this.name = name;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据CODE获取枚举实例
     * @param code 枚举编号
     * @return 枚举实例
     */
    public static AccessHistoryTypeEnum getEnum(Byte code){
        for(AccessHistoryTypeEnum animal: AccessHistoryTypeEnum.values()){
            if(animal.code.equals(code)){
                return animal;
            }
        }
        return null;
    }
}
